package structureType.flyweight.simple;

import java.util.Hashtable;

public class FlyWeightFactory {
    // Fields
    private Hashtable<String, ConcreteFlyWeight> flyweights = new Hashtable<String, ConcreteFlyWeight>();

    // Constructors
    public void setFlyWeight(String name) {
        flyweights.put(name, new ConcreteFlyWeight(name));
    }

    // Methods
    public FlyWeight getFlyWeight(String key) {
        return ((FlyWeight) flyweights.get(key));
    }

    public int getSize() {
        return flyweights.size();
    }
}
